# <> 提取参数

# 自定义转换器

from werkzeug.routing import BaseConverter
from flask import Flask

app = Flask(__name__)

class RegexConverter(BaseConverter):
    def __int__(self,url_map,regex):
        super(RegexConverter, self).__int__(url_map)
        self.regex = regex

    def to_python(self, value):
        return value


# 将自定义的转换器类添加到flask应用中
app.url_map.converters['re'] = RegexConverter

@app.route('/index/<re("123"):value>')
def index(value):
    print("成功")
    return 'hello'

if __name__ == '__main__':
    app.run()